package cs5226.model;

public class ThresholdBean {
	
	public static int HEALTHY = 0;
	public static int UNHEALTHY = 1;
	public static int CRITICAL = 2;
	
	private String paramID;
	private String paramName;
	private String paramUnit;
	private double min;
	private double unhealthy;
	private double critical;
	private double max;
	
	public String getParamID() {
		return paramID;
	}
	public void setParamID(String paramID) {
		this.paramID = paramID;
	}
	public String getParamName() {
		return paramName;
	}
	public void setParamName(String paramName) {
		this.paramName = paramName;
	}
	public double getMin() {
		return min;
	}
	public void setMin(double min) {
		this.min = min;
	}
	public double getUnhealthy() {
		return unhealthy;
	}
	public void setUnhealthy(double d) {
		this.unhealthy = d;
	}
	public double getCritical() {
		return critical;
	}
	public void setCritical(double critical) {
		this.critical = critical;
	}
	public double getMax() {
		return max;
	}
	public void setMax(double max) {
		this.max = max;
	}
	public String getParamUnit() {
		return paramUnit;
	}
	public void setParamUnit(String paramUnit) {
		this.paramUnit = paramUnit;
	}
	
	public int assess (SingleValueStatistics stat) {
		double value = stat.getValue();
		
		if (critical >= unhealthy) {
			if (value >= critical) return CRITICAL;
			else if (value >= unhealthy) return UNHEALTHY;
			else return HEALTHY;
		}
		else {
			if (value <= critical) return CRITICAL;
			else if (value <= unhealthy) return UNHEALTHY;
			else return HEALTHY;
		}
	}
	
}
